package com.loves.admin.model;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.loves.admin.util.Converter.LocalDateTimeConverter;

import java.time.LocalDateTime;

@TableName(value = "user")
public class User {

    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    @ExcelProperty(value = "用户姓名",index = 0)
    private String name;

    @ExcelProperty(value = "用户年龄",index = 1)
    private Integer age;

    @ExcelProperty(value = "用户性别",index = 2)
    private Integer gender;

    private String userName;

    @ExcelProperty(value = "创建时间",index = 3, converter = LocalDateTimeConverter.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDate;

    @ExcelProperty(value = "创建人",index = 4)
    private String createName;

    private String exportId;

    private String accountId;

    private Boolean deleteFlag;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public LocalDateTime getCreateDate() {
        return createDate;
    }

    public void setCreateDate(LocalDateTime createDate) {
        this.createDate = createDate;
    }

    public String getCreateName() {
        return createName;
    }

    public void setCreateName(String createName) {
        this.createName = createName;
    }

    public String getExportId() {
        return exportId;
    }

    public void setExportId(String exportId) {
        this.exportId = exportId;
    }

    public String getAccountId() {
        return accountId;
    }

    public void setAccountId(String accountId) {
        this.accountId = accountId;
    }

    public Boolean getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(Boolean deleteFlag) {
        this.deleteFlag = deleteFlag;
    }


    public static final class Builder {
        private String id;
        private String name;
        private Integer age;
        private Integer gender;
        private String userName;
        private LocalDateTime createDate;
        private String createName;
        private String exportId;
        private String accountId;
        private Boolean deleteFlag;

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder age(Integer age) {
            this.age = age;
            return this;
        }

        public Builder gender(Integer gender) {
            this.gender = gender;
            return this;
        }

        public Builder userName(String userName) {
            this.userName = userName;
            return this;
        }

        public Builder createDate(LocalDateTime createDate) {
            this.createDate = createDate;
            return this;
        }

        public Builder createName(String createName) {
            this.createName = createName;
            return this;
        }

        public Builder exportId(String exportId) {
            this.exportId = exportId;
            return this;
        }

        public Builder accountId(String accountId) {
            this.accountId = accountId;
            return this;
        }

        public Builder deleteFlag(Boolean deleteFlag) {
            this.deleteFlag = deleteFlag;
            return this;
        }

        public User build() {
            User user = new User();
            user.setId(id);
            user.setName(name);
            user.setAge(age);
            user.setGender(gender);
            user.setUserName(userName);
            user.setCreateDate(createDate);
            user.setCreateName(createName);
            user.setExportId(exportId);
            user.setAccountId(accountId);
            user.setDeleteFlag(deleteFlag);
            return user;
        }
    }
}
